<?php
namespace ctrl\demo;
use L;
use Sdk\YunWms\callYunWmsApiUtil;


class yumwms
{
    //跨运通 http://ec.com/?c=demo_yumwms&a=warehouseList
    public static function warehouseList()
    {
        $data = [
            "pageSize" => 50,
            "page" => 1
        ];
        $param = json_encode($data);
        $result = (new callYunWmsApiUtil())->callApi('getWarehouse', $param);
        echo '<pre>';
        print_r($result);
    }

    //拉取跨运通的库存数据 http://ec.com/?c=demo_yumwms&a=pull
    public static function pull()
    {
        $result = \serv\task\warehouse\yumwms::pull();
    }


    //同步库存队列  http://ec.com/?c=demo_yumwms&a=pullQueue
    public static function pullQueue()
    {
        $string = '{"warehouse_id":"158","warehouse_code":"DECGN2"}';
        $data['data'] = json_decode($string, true);
        $result = \serv\queue\warehouse\yunwms::pull($data);
        var_dump($result);
    }


    //检查或者更新库存  http://ec.com/?c=demo_yumwms&a=stock
    public static function stock()
    {
        $string = '{"product_barcode":"Y058-A0047-LC2-BS","product_sku":"A0047-LC2-BS","reference_no":"","product_title":"沙发-单人黑皮","product_title_en":"sofa","warehouse_code":"DECGN2","onway":"0","pending":"0","sellable":"0","unsellable":"0","reserved":"0","shipped":"17","sold_shared":"0","pi_update_time":"2024-06-17 18:55:06","shared":"0","warning":"0","warehouse_id":"158","warehouse_desc":"DECGN2","batch_info":[]}';
        $data['data'] = json_decode($string, true);
        $result = \serv\queue\warehouse\yunwms::check($data);
        var_dump($result);
    }


}